home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / Form / Sources / Views.fr < prev   
Encoding:
Text File  |  1996-09-17  |  16.2 KB  |  568 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //    File:                Views.fr
  3. //    Release Version:    $ ODF 2 $
  4. //
  5. //    Contains:            Resources defining the Form part's views
  6. //
  7. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  8. //========================================================================================
  9.  
  10. #ifndef FWRESFIL_K
  11. #include "FWResFil.k"
  12. #endif
  13.  
  14. #ifndef FWVIEWS_FR
  15. #include "FWViews.fr"
  16. #endif
  17.  
  18. #ifndef FWNOTDEF_H
  19. #include "FWNotDef.h"     
  20. #endif
  21.  
  22. #ifndef DEFINES_K
  23. #include "Defines.k"
  24. #endif
  25.  
  26. //========================================================================================
  27. // Defines
  28. //========================================================================================
  29.  
  30. // H & V are reference size for the Form frame.
  31. // Their values are not important because all the views will be resized at runtime 
  32. // to adjust to the real frame size defined by the part. What is important is the 
  33. // placement of the subviews relative to this reference size and their binding flags.
  34. // Note: in this example the bounds & bindings of RFormView, the content view, are not 
  35. // important either because the frame takes care of it in CFormView::CenterInFrame() 
  36.  
  37. #define H    FW_FIX(600)
  38. #define V    FW_FIX(1000)
  39.  
  40. // Fonts not defined in "FWViews.fr"
  41. #define TIMES_12_BOLD        { FW_FIX(12), FW_kBold, "Times" }
  42.  
  43. //========================================================================================
  44. // type RFormView
  45. //========================================================================================
  46.  
  47. type RFormView : FW_RPictSView(Label='Frmv')
  48. {
  49.     // This class adds a picture ID and 3 radio-clusters to FW_RSuperView
  50.     // (See code in CFormView::InitializeFromStream()).
  51. Picture2:
  52.     integer;
  53.     
  54.     FW_RRadioCluster;    
  55.     FW_RRadioCluster;    
  56.     FW_RRadioCluster;
  57. };
  58.  
  59. //========================================================================================
  60. // type RScrollEdit
  61. //========================================================================================
  62. // Custom scrolling edit view 
  63.  
  64. type RScrollEdit : FW_REditView(Label='Sedv')
  65. {
  66. HorizViewID:
  67.     longint;            // Horizontal scrollbar id, or 0 for no scrollbar
  68. VertViewID:
  69.     longint;            // Vertical scrollbar id, or 0 for no scrollbar
  70. TextWidth:
  71.     FW_RFixed;            // text width (or 0 to use same width as view)
  72. };
  73.  
  74. //========================================================================================
  75. // resource RFormFrame(kFormView)
  76. //========================================================================================
  77. // See constants in "FWViews.k", macros & resource types in "FWViews.fr"
  78.  
  79. resource FW_RFrameLayout(kFormView)
  80. {
  81.     {H,V},                    // LayoutSize
  82.     {                        // Start list of frame's subviews
  83.         RFormView
  84.         (
  85.             kFormViewID,                // view id
  86.             {0, 0, H, V},                // bounds
  87.             FW_kFitToEnclosure,            // bindings
  88.             FW_POINT(560, 800),            // extent
  89.             1,                            // Make it the ContentView
  90.             FW_kXYScrolling,            // scrolling direction
  91.             {                    // Start list of SubViews
  92.                 FW_REditView    // First name
  93.                 (
  94.                     kFirstNameEdViewID,                // view id
  95.                     FW_BOUNDS(290, 90, 450, 107),    // bounds
  96.                     FW_kFixedBounds,                // binding
  97.                     20,                                // max chars
  98.                     9,                                // attributes
  99.                     TIMES_12_BOLD,
  100.                     ""                                // initial text
  101.                 ),
  102.                 FW_REditView    // Last name
  103.                 (
  104.                     kLastNameEdViewID,                // view id
  105.                     FW_BOUNDS(290, 110, 450, 127),
  106.                     FW_kFixedBounds,                // binding
  107.                     20,                                // max chars
  108.                     9,                                // attributes
  109.                     TIMES_12_BOLD,
  110.                     ""                                // initial text
  111.                 ),
  112.                 FW_REditView    // member name
  113.                 (
  114.                     kMemberNameEdViewID,            // view id
  115.                     FW_BOUNDS(290, 130, 450, 147),
  116.                     FW_kFixedBounds,                // binding
  117.                     20,                                // max chars
  118.                     9,                                // attributes
  119.                     TIMES_12_BOLD,
  120.                     ""                                // initial text
  121.                 ),
  122.                 FW_REditView    // e-mail address
  123.                 (
  124.                     kEMailEdViewID,                    // view id
  125.                     FW_BOUNDS(290, 150, 450, 167),
  126.                     FW_kFixedBounds,                // binding
  127.                     30,                                // max chars
  128.                     9,                                // attributes
  129.                     TIMES_12_BOLD,
  130.                     ""                                // initial text
  131.                 ),
  132. /**                
  133.                 FW_RScrollBar    // Horizontal scrollbar for text-edit
  134.                 (
  135.                     kEditHScrollBarID,            // view id
  136.                     {FW_FIX(30), FW_FIX(289), FW_FIX(450), FW_FIX(305)},    // bounds 
  137.                     FW_kFixedBounds,            // view binding
  138.                     0,                            // control message
  139.                     0,                            // control receiver
  140.                     0,                            // control value
  141.                     0,                            // SB Min Value (adjusted at runtime)
  142.                     1,                            // SB Max Value (adjusted at runtime)
  143.                     FW_ONE,                        // SB Minor Units (adjusted at runtime)
  144.                     FW_ONE                        // SB Major Units (adjusted at runtime)
  145.                 ),
  146. **/
  147.                 FW_RScrollBar    // Vertical scrollbar for text-edit
  148.                 (
  149.                     kEditVScrollBarID,            // view id
  150.                     FW_BOUNDS(449, 200, 465, 290),
  151.                     FW_kFixedBounds,            // view binding
  152.                     0,                            // control message
  153.                     0,                            // control receiver
  154.                     0,                            // control value
  155.                     0,                            // SB Min Value (adjusted at runtime)
  156.                     1,                            // SB Max Value (adjusted at runtime)
  157.                     FW_ONE,                        // SB Minor Units (adjusted at runtime)
  158.                     FW_ONE                        // SB Major Units (adjusted at runtime)
  159.                 ),
  160.                 RScrollEdit        // Comments (custom scrolling edit view)
  161.                 (
  162.                     kCommentsEdViewID,                // view id
  163.                     FW_BOUNDS(30, 200, 450, 290),
  164.                     FW_kFixedBounds,                // binding
  165.                     -1,                                // max chars (32K)
  166.                     13,                                // attributes
  167.                     FW_NORMAL_FONT,
  168.                     "",                                // initial text
  169.                     0, // kEditHScrollBarID,        // Horizontal SB
  170.                     kEditVScrollBarID,                // Vertical SB
  171.                     FW_FIX(600)                        // text width (used only with horiz SB)
  172.                 ),
  173.                 FW_RButton
  174.                 (
  175.                     kSubscribeCheckID,                // view id
  176.                     FW_BOUNDS(30, 310, 200, 324),
  177.                     FW_kFixedBounds,                // binding
  178.                     FW_kButtonPressedMsg,            // control message
  179.                     0,                                // control receiver
  180.                     1,                                // control value
  181.                     FW_kCheckButton,                // button kind
  182.                     TIMES_12_BOLD,
  183.                     "Subscribe to ODFFlash"            
  184.                 ),
  185.                 FW_RGroupBox
  186.                 (
  187.                     0,                                // view id
  188.                     FW_BOUNDS(30, 360, 220, 440),
  189.                     FW_kFixedBounds,                // binding
  190.                     TIMES_12_BOLD,
  191.                     FW_RGB_WHITE,                    // erase color
  192.                     "Modem speed used"
  193.                 ),
  194.                 FW_RButton
  195.                 (
  196.                     k14400RadioID,                    // view id
  197.                     FW_BOUNDS(40, 380, 210, 396),
  198.                     FW_kFixedBounds,                // binding
  199.                     0,                                // control message
  200.                     0,                                // control receiver
  201.                     0,                                // control value
  202.                     FW_kRadioButton,                // button kind
  203.                     FW_SYSTEM_FONT,
  204.                     "14.4 Kbps or lower"            
  205.                 ),
  206.                 FW_RButton
  207.                 (
  208.                     k28800RadioID,                    // view id
  209.                     FW_BOUNDS(40, 400, 210, 416),
  210.                     FW_kFixedBounds,                // binding
  211.                     0,                                // control message
  212.                     0,                                // control receiver
  213.                     1,                                // control value
  214.                     FW_kRadioButton,                // button kind
  215.                     FW_SYSTEM_FONT,
  216.                     "28.8 Kbps to 256 Kbps"            
  217.                 ),
  218.                 FW_RButton
  219.                 (
  220.                     kFasterRadioID,                    // view id
  221.                     FW_BOUNDS(40, 420, 210, 436),
  222.                     FW_kFixedBounds,                // binding
  223.                     0,                                // control message
  224.                     0,                                // control receiver
  225.                     0,                                // control value
  226.                     FW_kRadioButton,                // button kind
  227.                     FW_SYSTEM_FONT,
  228.                     "Faster than 256 Kbps"            
  229.                 ),
  230.                 FW_RListBox
  231.                 (
  232.                     kPlatformListBoxID,                // view id
  233.                     FW_BOUNDS(250, 362, 400, 440),
  234.                     FW_kFixedBounds,                // binding
  235.                     10,                                // number of rows
  236.                     1,                                // vertical SB
  237.                     0,                                // single selection
  238.                     1,                                // use focus frame
  239.                     0,                                // use clientdata
  240.                     FW_kListBoxDoubleClickedMsg,    // DblClick message
  241.                     FW_HELVETICA12,                    // font
  242.                     {                                // List of strings
  243.                         "Mac OS",
  244.                         "OS/2 Warp",
  245.                         "Windows 95",
  246.                         "Windows NT",
  247.                         "IBM AIX",
  248.                         "Sun Sparc Solaris",
  249.                         "Sun OS 4.1.x",
  250.                         "HP /UX",
  251.                         "Unix IRIX",
  252.                         "Unix Linux"
  253.                     }
  254.                 ),
  255.                 FW_RButton
  256.                 (
  257.                     kAddButtonID,                    // view id
  258.                     FW_BOUNDS(410, 370, 480, 390),
  259.                     FW_kFixedBounds,                // binding
  260.                     FW_kButtonPressedMsg,            // control message
  261.                     FW_kFrameReceiver,                // receiver
  262.                     0,                                // control value
  263.                     FW_kPushButton,                    // button kind
  264.                     FW_SYSTEM_FONT,
  265.                     "Add"            
  266.                 ),
  267.                 FW_RButton
  268.                 (
  269.                     kRemoveButtonID,                // view id
  270.                     FW_BOUNDS(410, 400, 480, 420),
  271.                     FW_kFixedBounds,                // binding
  272.                     FW_kButtonPressedMsg,            // control message
  273.                     FW_kFrameReceiver,                // receiver
  274.                     0,                                // control value
  275.                     FW_kPushButton,                    // button kind
  276.                     FW_SYSTEM_FONT,
  277.                     "Remove"            
  278.                 ),
  279.                 FW_RPopupMenu
  280.                 (
  281.                     kBrowseTimePopupID,                // view id
  282.                     FW_BOUNDS(30, 477, 230, 497),
  283.                     FW_kFixedBounds,                // binding
  284.                     FW_kPopupClickedMsg,            // control message
  285.                     FW_kFrameReceiver,                // control receiver
  286.                     0,                                // control value
  287.                     kBrowseTimeMenuResID,            // Mac menu id
  288.                     0,                                // title width
  289.                     2,                                // Initial menu item
  290.                     0,                                // Menu variation
  291.                     0,                                // Menu refCon    
  292.                     FW_SYSTEM_FONT,
  293.                     ""                                // title
  294.                 ),
  295.                 FW_RPopupMenu
  296.                 (
  297.                     kOnlineTimePopupID,                // view id
  298.                     FW_BOUNDS(30, 540, 230, 560),
  299.                     FW_kFixedBounds,                // binding
  300.                     FW_kPopupClickedMsg,            // control message
  301.                     0,                                // control receiver
  302.                     0,                                // control value
  303.                     kOnlineTimeMenuResID,            // Mac menu id
  304.                     0,                                // title width
  305.                     1,                                // Initial menu item
  306.                     0,                                // Menu variation
  307.                     0,                                // Menu refCon    
  308.                     FW_SYSTEM_FONT,
  309.                     ""                                // title
  310.                 ),
  311.                 FW_RGroupBox
  312.                 (
  313.                     0,                                // view id
  314.                     FW_BOUNDS(30, 580, 350, 700),
  315.                     FW_kFixedBounds,                // binding
  316.                     TIMES_12_BOLD,
  317.                     FW_RGB_WHITE,                    // erase color
  318.                     " How did you discover ODFWired?"            
  319.                 ),
  320.                 FW_RButton
  321.                 (
  322.                     kWordOfMouthRadioID,            // view id
  323.                     FW_BOUNDS(40, 600, 300, 616),
  324.                     FW_kFixedBounds,                // binding
  325.                     0,                                // control message
  326.                     0,                                // control receiver
  327.                     0,                                // control value
  328.                     FW_kRadioButton,                // button kind
  329.                     FW_SYSTEM_FONT,
  330.                     "Word of mouth"            
  331.                 ),
  332.                 FW_RButton
  333.                 (
  334.                     kHyperLinkRadioID,                // view id
  335.                     FW_BOUNDS(40, 620, 300, 636),
  336.                     FW_kFixedBounds,                // binding
  337.                     0,                                // control message
  338.                     0,                                // control receiver
  339.                     0,                                // control value
  340.                     FW_kRadioButton,                // button kind
  341.                     FW_SYSTEM_FONT,
  342.                     "Hyperlink from another site:"            
  343.                 ),
  344.                 FW_RButton
  345.                 (
  346.                     kMacTechRadioID,                // view id
  347.                     FW_BOUNDS(40, 640, 300, 656),
  348.                     FW_kFixedBounds,                // binding
  349.                     0,                                // control message
  350.                     0,                                // control receiver
  351.                     1,                                // control value
  352.                     FW_kRadioButton,                // button kind
  353.                     FW_SYSTEM_FONT,
  354.                     "Ad in MacTech Magazine"            
  355.                 ),
  356.                 FW_RButton
  357.                 (
  358.                     kMagazineRadioID,                // view id
  359.                     FW_BOUNDS(40, 660, 300, 676),
  360.                     FW_kFixedBounds,                // binding
  361.                     0,                                // control message
  362.                     0,                                // control receiver
  363.                     0,                                // control value
  364.                     FW_kRadioButton,                // button kind
  365.                     FW_SYSTEM_FONT,
  366.                     "Other magazine, newspaper, radio"            
  367.                 ),
  368.                 FW_RButton
  369.                 (
  370.                     kOtherRadioID,                    // view id
  371.                     FW_BOUNDS(40, 680, 300, 696),
  372.                     FW_kFixedBounds,                // binding
  373.                     0,                                // control message
  374.                     0,                                // control receiver
  375.                     0,                                // control value
  376.                     FW_kRadioButton,                // button kind
  377.                     FW_SYSTEM_FONT,
  378.                     "Other"            
  379.                 ),
  380.                 FW_RButton
  381.                 (
  382.                     kYesRadioID,                    // view id
  383.                     FW_BOUNDS(40, 725, 100, 740),
  384.                     FW_kFixedBounds,                // binding
  385.                     0,                                // control message
  386.                     0,                                // control receiver
  387.                     0,                                // control value
  388.                     FW_kRadioButton,                // button kind
  389.                     FW_SYSTEM_FONT,
  390.                     "Yes"            
  391.                 ),
  392.                 FW_RButton
  393.                 (
  394.                     kNoRadioID,                        // view id
  395.                     FW_BOUNDS(40, 745, 100, 760),
  396.                     FW_kFixedBounds,                // binding
  397.                     FW_kButtonPressedMsg,            // control message
  398.                     FW_kFrameReceiver,                // control receiver
  399.                     0,                                // control value
  400.                     FW_kRadioButton,                // button kind
  401.                     FW_SYSTEM_FONT,
  402.                     "No"            
  403.                 ),    
  404.                 FW_RButton
  405.                 (
  406.                     kSubscribeButtonID,                // view id
  407.                     FW_BOUNDS(300, 750, 450, 775),
  408.                     FW_kFixedBounds,                // binding
  409.                     FW_kButtonPressedMsg,            // control message
  410.                     FW_kFrameReceiver,                // receiver
  411.                     0,                                // control value
  412.                     FW_kPushButton,                    // button kind
  413.                     FW_SYSTEM_FONT,
  414.                     "Join ODFWired!"            
  415.                 )
  416.             },                            // End list of Subviews
  417.  
  418.             kFormPict1,                    // PictureID field of FW_RPictSView
  419.             kFormPict2,                    // PictureID field of RFormView
  420.             
  421.             // RFormView adds 3 radio-clusters to FW_RSuperView
  422.             FW_RRadioCluster    
  423.             (
  424.                 { k14400RadioID, k28800RadioID, kFasterRadioID } // List of radios
  425.             ),
  426.             FW_RRadioCluster    
  427.             (
  428.                 { kWordOfMouthRadioID, kHyperLinkRadioID, kMacTechRadioID,
  429.                     kMagazineRadioID, kOtherRadioID } // List of radios
  430.             ),
  431.             FW_RRadioCluster    
  432.             (
  433.                 { kYesRadioID, kNoRadioID }            // List of radios
  434.             )             
  435.     
  436.         ),                            // End RFormView resource
  437.         FW_RScrollBar        // Horizontal
  438.         (
  439.             kHorzScrollBarID,            // view id
  440.             FW_STDHORIZONTALSB(H,V),    //  bounds 
  441.             FW_kHScrollBarBinding,        // Standard horizontal SB binding
  442.             0,                            // control message
  443.             0,                            // control receiver
  444.             0,                            // control value
  445.             0,                            // SB Min Value (adjusted at runtime)
  446.             1,                            // SB Max Value (adjusted at runtime)
  447.             FW_ONE,                        // SB Minor Units (adjusted at runtime)
  448.             FW_ONE                        // SB Major Units (adjusted at runtime)
  449.         ),
  450.         FW_RScrollBar        // Vertical
  451.         (
  452.             kVertScrollBarID,            // view id
  453.             FW_STDVERTICALSB(H, V),        // bounds 
  454.             FW_kVScrollBarBinding,        // Standard vertical SB binding
  455.             0,                            // control message
  456.             0,                            // control receiver
  457.             0,                            // control value
  458.             0,                            // SB Min Value (adjusted at runtime)
  459.             1,                            // SB Max Value (adjusted at runtime)
  460.             FW_ONE,                        // SB Minor Units (adjusted at runtime)
  461.             FW_ONE                        // SB Major Units (adjusted at runtime)
  462.         ),
  463.         FW_RGrowBox
  464.         (
  465.             kGrowBoxID,                    // view ID
  466.             FW_STDGROWBOX(H,V),            // bounds
  467.             FW_kGrowBoxBinding            // standard grow box binding
  468.         )
  469.     },                            // End list of frame's subviews
  470.     
  471.     {                        // Scroller
  472.         FW_RScrollBarScroller
  473.         (
  474.             0,                            // AutoScrollInset: not used here
  475.             {FW_FIX(16), FW_FIX(16)},    // Scroll Units
  476.             1,                            // Responds to function key
  477.             0,                            // Live Scrolling
  478.             kHorzScrollBarID,            // Horizontal scroll-bar ID
  479.             kVertScrollBarID            // Vertical scroll-bar ID
  480.         ) 
  481.     }
  482. };
  483.  
  484. //========================================================================================
  485. // type RPwdEditView
  486. //========================================================================================
  487. // Custom edit view to type hidden passwords
  488.  
  489. type RPwdEditView : FW_REditView(Label='Pwdv')
  490. {
  491. };
  492.  
  493. //========================================================================================
  494. // resource FW_RFrameLayout(kPasswordDialog)
  495. //========================================================================================
  496. // See constants in "FWViews.k", macros & resource types in "FWViews.fr"
  497.  
  498. resource FW_RFrameLayout(kPasswordDialog)
  499. {
  500.     {FW_FIX(100),FW_FIX(100)},        // LayoutSize
  501.     
  502.     {                        // Start list of frame's subviews
  503.         FW_RStaticText
  504.         (
  505.             0,                            // view id
  506.             FW_BOUNDS(20, 40, 140, 60),
  507.             FW_kFixedBounds,            // binding
  508.             FW_NORMAL_FONT,
  509.             FW_RGB_LIGHT_GRAY,            // erase color
  510.             "Pick a password:"            
  511.         ),
  512.         FW_RStaticText 
  513.         (
  514.             0,                            // view id
  515.             FW_BOUNDS(20, 70, 140, 90),
  516.             FW_kFixedBounds,            // binding
  517.             FW_NORMAL_FONT, 
  518.             FW_RGB_LIGHT_GRAY,            // erase color
  519.             "Retype to verify:"            
  520.         ),
  521.         RPwdEditView        // edit view to enter new password
  522.         (
  523.             kPasswordEditID,            // view id
  524.             FW_BOUNDS(150, 40, 280, 60),
  525.             FW_kFixedBounds,            // binding
  526.             10,                            // max chars
  527.             9,                            // attributes
  528.             FW_NORMAL_FONT, 
  529.             ""                            // initial text
  530.         ), 
  531.         RPwdEditView        // edit view to confirm password
  532.         (
  533.             kConfirmEditID,                // view id
  534.             FW_BOUNDS(150, 70, 280, 90),
  535.             FW_kFixedBounds,            // binding
  536.             10,                            // max chars
  537.             9,                            // attributes
  538.             FW_NORMAL_FONT, 
  539.             ""                            // initial text
  540.         ), 
  541.         FW_RButton
  542.         (
  543.             kOKButtonID,                // view id
  544.             FW_BOUNDS(180, 120, 260, 148),
  545.             FW_kFixedBounds,            // binding
  546.             FW_kDefaultButtonMsg,        // "OK" message
  547.             0,                            // receiver = dialogFrame by default
  548.             0,                            // control value
  549.             FW_kDefaultPushButton,        // button kind (with outline)
  550.             FW_NORMAL_FONT,
  551.             "OK"            
  552.         ),
  553.         FW_RButton
  554.         (
  555.             kCancelButtonID,            // view id
  556.             FW_BOUNDS(60, 123, 120, 145),
  557.             FW_kFixedBounds,            // binding
  558.             FW_kCancelButtonMsg,        // "Cancel" message
  559.             0,                            // receiver = dialogFrame by default
  560.             0,                            // control value
  561.             FW_kPushButton,                // button kind
  562.             FW_NORMAL_FONT,
  563.             "Cancel"            
  564.         )
  565.     },                        // End list of frame's subviews
  566.     { }                        // no scroller
  567. }; 
  568.